class Wu {
  school = 'gxnu'
  constructor(name, age) {
    this.name = name
    this.age = age
  }
  getSchool() {
    return this.school
  }
}

class WuMock {
  constructor() {
    Wu.calls = [...arguments]
    return new Wu(...arguments)
  }
}

// let _constructor = Wu.prototype.constructor
// Wu.prototype.constructor = function() {
//   Wu.calls = [...arguments]
//   console.log('执行了～')
//   return _constructor.apply(this, [...arguments])
// }

// 无效：改变原类原型上的constructor
// Wu.prototype.constructor = class Wu {
//   school = '嘻嘻'
//   constructor(name, age) {
//     console.log('lllll～')
//     this.name = name
//     this.age = age
//   }
//   getSchool() {
//     return this.school
//   }
// }
const w = new WuMock('wsj', 25) // 可行
console.log(w) // {school: 'gxnu', name: 'wsj', age: 25}
console.log(Wu.calls) // ['wsj', 25]
// class Wu {\n  school = 'gxnu'\n  constructor(name, age) {\n    this.name = name\n    this.age = age\n  }\n  getSchool() {\n    return this.school\n  }\n}


// 无效：不能重复定义同名class
// class Wu {
//   constructor() {
//     console.log('类覆盖')
//   }
// }

// console.log(new Wu())